From 6a368fe8aac6800c0cf4f7bbd641d1583f34eece Mon Sep 17 00:00:00 2001 From: "sos22@douglas.cl.cam.ac.uk" Date: Fri, 15 Jul 2005 09:24:29 +0000 Subject: [PATCH] Avoid some unnecessary TLB flushes. This will probably make no real difference on any sensible guest operating system. Signed-off-by: Steven Smith, sos22@cl.cam.ac.uk. --- xen/arch/x86/mm.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 2c530cf261..a8c9708f58 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -1352,18 +1352,22 @@ int get_page_type(struct pfn_info *page, u32 type) { if ( (x & (PGT_type_mask|PGT_va_mask)) != type ) { - /* - * On type change we check to flush stale TLB entries. This - * may be unnecessary (e.g., page was GDT/LDT) but those - * circumstances should be very rare. - */ - cpumask_t mask = page_get_owner(page)->cpumask; - tlbflush_filter(mask, page->tlbflush_timestamp); - - if ( unlikely(!cpus_empty(mask)) ) + if ( (x & PGT_type_mask) != (type & PGT_type_mask) ) { - perfc_incrc(need_flush_tlb_flush); - flush_tlb_mask(mask); + /* + * On type change we check to flush stale TLB + * entries. This may be unnecessary (e.g., page + * was GDT/LDT) but those circumstances should be + * very rare. + */ + cpumask_t mask = page_get_owner(page)->cpumask; + tlbflush_filter(mask, page->tlbflush_timestamp); + + if ( unlikely(!cpus_empty(mask)) ) + { + perfc_incrc(need_flush_tlb_flush); + flush_tlb_mask(mask); + } } /* We lose existing type, back pointer, and validity. */ -- 2.30.2